import java.text.DecimalFormat;


public abstract class FunctionMode {

	static public long time;
	static public long rotations;
	static public long lastSecondRotations;
	public static final double circumference = 150; //in cm
	
	public abstract void Compute();
	
	public abstract String GetDisplayString();
	
	public abstract double GetValue();
	
	public abstract String ModeName();
	
	protected DecimalFormat df = new DecimalFormat("#.###");
}

class Speed extends FunctionMode
{
	private static double value = 0;
	
	@Override
	public void Compute() {
		// TODO Auto-generated method stub
		value = 0.01 * 3.6 * circumference * lastSecondRotations; 
	}

	@Override
	public String GetDisplayString() {
		// TODO Auto-generated method stub
		return df.format(value);
	}

	@Override
	public double GetValue() {
		// TODO Auto-generated method stub
		return value;
	}

	@Override
	public String ModeName() {
		// TODO Auto-generated method stub
		return "Speed";
	}
	
}

class MaxSpeed extends FunctionMode
{
	private static double value;
	
	@Override
	public void Compute() {
		// TODO Auto-generated method stub
		if (value < new Speed().GetValue()) 
				value = new Speed().GetValue(); 
	}

	@Override
	public String GetDisplayString() {
		// TODO Auto-generated method stub
		return df.format(value);
	}

	@Override
	public double GetValue() {
		// TODO Auto-generated method stub
		return value;
	}

	@Override
	public String ModeName() {
		// TODO Auto-generated method stub
		return "MaxSpeed";
	}

	
}



